<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>奔跑的熊大</title>
    <style>
      body {
        background-color: #ccc;
      }
      .father {
        position: relative;
      }
      .bg1 {
        height: 250px;
        background: url(../image/bearbj2.png) no-repeat;
      }
      .bg2 {
        height: 200px;
        background: url(../image/bearbj1.png) no-repeat;
      }
      .bea {
        position: absolute;
        top: 370px;
        width: 200px;
        height: 100px;
        background: url(../image/bear.png) no-repeat;
        /* 我们元素可以添加多个动画，用逗号隔开 */
        animation: bear 1s steps(8) infinite, move 5s forwards;
      }
      @keyframes bear {
        0% {
          background-position: 0 0;
        }
        100% {
          background-position: -1600px 0;
        }
      }
      @keyframes move {
        0% {
          left: 0;
        }
        100% {
          left: 50%;
          transform: translate(-50%);
        }
      }
    </style>
  </head>
  <body>
    <div class="father">
      <div class="bg1"></div>
      <div class="bg2"></div>
      <div class="bea"></div>
    </div>
  </body>
</html>
